package tr.edu.yildiz.ce.app_manager.ui.components.menu;

import tr.edu.yildiz.ce.app_manager.ui.AppManagerApplication;
import tr.edu.yildiz.ce.app_manager.ui.action.menu.ApplicationAction;
import tr.edu.yildiz.ce.app_manager.ui.action.menu.ProxyAction;
import tr.edu.yildiz.ce.app_manager.ui.components.form.ApplicationForm;

import com.vaadin.event.ItemClickEvent;
import com.vaadin.event.ItemClickEvent.ItemClickListener;
import com.vaadin.ui.HorizontalLayout;

public class MenuLayout extends HorizontalLayout{

	/**
	 * 
	 */
	private static final long serialVersionUID = -7049828102508557726L;

	
	public MenuLayout(AppManagerApplication appl) {
		final AppManagerApplication app = appl;
		
		Menu menu = new Menu(null);
		menu.addListener(new ItemClickListener() {
			
			@Override
			public void itemClick(ItemClickEvent event) {
				if  (event.getItemId().toString().equals("Application")){
					new ApplicationAction(app).doAction();
				}else if (event.getItemId().toString().equals("AppProxy")){
					new ProxyAction(app).doAction();
				}
					
			}
		});
		addComponent(menu);
	}
	
}
